// type:0 =>2021-09-12 默认
// type:1 =>2021-09-12 10:34:12
// type:2 =>09-12 10:34:12
// type:3 =>09-12 
// type:4 =>2021/09/12 
// type:5 =>2021/09/12 10:34:12
// type:6 =>09/12 10:34:12
// type:7 =>09/12 
var getDate = function(str,type = 0) {
	// console.log('str',str)
	// console.log('type',type)
	let date = new Date(str)
	let y = date.getFullYear();
	let m = (date.getMonth()+1 + '').padStart(2,'0');
	let d = (date.getDate() + '').padStart(2,'0');
	let hh = (date.getHours() + '').padStart(2,'0')
	let mm = (date.getMinutes() + '').padStart(2,'0')
	let ss = (date.getSeconds() + '').padStart(2,'0')
	let time;
	switch (type) {
	    case 0:
	        time = `${y}-${m}-${d}`;
	        break;
	    case 1:
			time = `${y}-${m}-${d} ${hh}:${mm}:${ss}`;
	        break;
	    case 2:
	        time = `${m}-${d} ${hh}:${mm}:${ss}`;
	        break;
	    case 3:
	        time = `${m}-${d}`;
	        break;
	    case 4:
	        time = `${y}/${m}/${d}`;
	        break;
	    case 5:
	        time = `${y}/${m}/${d} ${hh}:${mm}:${ss}`;
	        break;
	    case 6:
	       time = `${m}/${d} ${hh}:${mm}:${ss}`;
	        break; 
		case 7:
	        time = `${m}/${d}`;
	        break;
	}
	return time;
}
export default{
	getDate
}
